import request from "@/request/api";

//通过组织查询用户
export function getUserDataByOrg(data) {
  return request({
    url: "/eam-service-system/system/staff/queryStaffListByOrgWithMerge",
    method: "get",
    params: data,
  });
}
//获取单个用户基本信息(不包含权限信息)
export function getUserDataByAccount(data) {
  return request({
    url: "/eam-service-system/system/staff/getSingleUserInfo",
    method: "get",
    params: data,
  });
}
//3、批量新增人员
export function addMultipleUser(data) {
  return request({
    url: "/eam-service-system/system/staff/batchInUpUser",
    method: "post",
    data: data,
  });
}
//批量删除人员
export function deleteMultipleUser(data) {
  return request({
    url: "/eam-service-system/system/staff/deleteIds",
    method: "delete",
    params: data,
  });
}
//修改人员
export function addOrEditUser(params, data) {
  return request({
    url: "/eam-service-system/system/staff/updateUser",
    method: "put",
    params: params,
    data: data,
  });
}
//删除人员
export function deleteOnceUser(data) {
  return request({
    url: "/eam-service-system/system/staff/delete",
    method: "delete",
    params: data,
  });
}

//查询用户角色
export function queryUserRole(data) {
  return request({
    url: "/eam-service-system/system/role/queryUserRole",
    method: "get",
    params: data,
  });
}
//保存用户角色
export function saveUserRole(params, data) {
  return request({
    url: "/eam-service-system/system/role/saveUserRole",
    method: "put",
    params: params,
    data: data,
  });
}

//统一用户平台
//统一用户组织树查询
export function getCommonOrgTree(data) {
  return request({
    url: "/eam-service-system/system/unifyUser/queryOrgNodeList",
    method: "get",
    params: data,
  });
}
//统一用户分页查询
export function getCommonUser(data) {
  return request({
    url: "/eam-service-system/system/unifyUser/queryStaffList",
    method: "get",
    params: data,
  });
}
//统一平台组织分页查询
export function getCommonOrgList(data) {
  return request({
    url: "/eam-service-system/system/unifyUser/queryOrgNodeList",
    method: "get",
    params: data,
  });
}

//外单位用户注册
export function outStaffInsert(data) {
  return request({
    url: "/eam-service-system/system/outStaff/insert",
    method: "post",
    data: data,
  });
}
//外单位用户审核列表
export function queryAuditList(data) {
  return request({
    url: "/eam-service-system/system/outStaff/queryAuditList",
    method: "get",
    params: data,
  });
}
//外单位用户审核
export function outStaffAudit(data) {
  return request({
    url: "/eam-service-system/system/outStaff/audit",
    method: "put",
    data: data,
  });
}

//设置新密码
export function resetPassword(data) {
  return request({
    url: "/eam-service-system/system/staff/resetPw",
    method: "put",
    params: data,
  });
}

//发送手机验证码
export function sendPhoneMessage(data) {
  return request({
    url: "/eam-service-system/system/outStaff/sendPhoneMessage",
    method: "get",
    params: data,
  });
}

//退出登录
export function signOut(data) {
  return request({
    url: "/eam-service-system/system/staff/signOut",
    method: "get",
    params: data,
  });
}

/**
 * 委托管理接口
 */
//委托人列表查询接口
export function queryAgentList(data) {
  return request({
    url: "/eam-service-system/agent/queryAgentList",
    method: "get",
    params: data,
  });
}

//查询账号委托人信息
export function queryAgentInfo(data) {
  return request({
    url: "/eam-service-system/agent/queryAgentList",
    method: "get",
    params: data,
  });
}

//授权
export function authorize(data) {
  return request({
    url: "/eam-service-system/agent/authorize",
    method: "post",
    data: data,
  });
}

//取消授权
export function removeAuth(data) {
  return request({
    url: "/eam-service-system/agent/cancel",
    method: "put",
    params: data,
  });
}

export function getStaffListInSystem() {
  return request({
    url: "/eam-service-system/system/org/syncOrgAndUser",
    method: "get",
  });
}
